<?php
	class Managemenu extends CI_Controller
    {
        public function __construct() {
            parent::__construct();
            $this->load->helper('url');
            $this->load->library('checkuser');
            $this->checkuser->CheckUserLogin();  
        }
        
        public function index()
        {
            $this->load->model('admin/manageheader', 'header');
            $danhmuc = $this->header->getDanhMuc();            
            $temp['title'] = 'Header - Admin Control Panel';
            $temp['template'] = 'admin/managemenu'; 
            $temp['data']['info'] = 'Danh mục';
            $temp['data']['bangdanhmuc'] = $danhmuc;           
            $this->load->view('admin/template/layout', $temp);
        }
        
        public function themDanhMuc()
        {
            $temp['title'] = 'Header - Admin Control Panel';
            $temp['template'] = 'admin/themdanhmuc'; 
            $temp['data']['info'] = 'Thêm danh mục';        
            $this->load->view('admin/template/layout', $temp);
        }
        
        public function updateHienThi()
        {           
            $typeDanhMuc = isset($_POST['typeDanhMuc']) ? $_POST['typeDanhMuc'] : "";
            $maDanhMuc = isset($_POST['maDanhMuc']) ? $_POST['maDanhMuc'] : "";
            $isDisplay =  isset($_POST['isDisplay']) ? $_POST['isDisplay'] : "";
            if($typeDanhMuc != "" && $maDanhMuc != "" && $isDisplay != "")
            {
                $this->load->model('admin/manageheader', 'header');
                $result = $this->header->updateDanhMuc($maDanhMuc, $typeDanhMuc, $isDisplay);
                echo $result;
            }
            else echo 'false';
        }
    }
?>